package com.rambo.baselib.util;

import ohos.eventhandler.EventHandler;
import ohos.eventhandler.EventRunner;

public class UiExecutor {
    private EventHandler eventHandler;
    private static volatile UiExecutor instance = new UiExecutor();

    private UiExecutor() {
        eventHandler = new EventHandler(EventRunner.getMainEventRunner());
    }

    public static UiExecutor getInstance() {
        return instance;
    }

    public void runOnMainThread(Runnable runnable) {
        eventHandler.postTask(runnable);
    }
}
